<!DOCTYPE html>
<#assign dicSelect=JspTaglibs["http://www.casic304.cn/dicSelect"] />
<#assign secSelect=JspTaglibs["http://www.casic304.cn/secSelect"] />
<#assign fillDept=JspTaglibs["http://www.casic304.cn/fillDept"] />
<html>
<head>
  <meta charset="utf-8">
  <title>质量信得过班组</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport"
        content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="${ctx}/layui/css/layui.css" media="all"/>
  <link rel="stylesheet" href="${ctx}/qbdmsStatic/iconfont/iconfont.css"/>
  <link rel="stylesheet" href="${ctx}/qbdmsStatic/style/forms/currencyCss.css">
  <link rel="stylesheet" href="${ctx}/qbdmsStatic/style/qbdms.css">
  <link rel="stylesheet" href="${ctx}/qbdmsStatic/public/ztree/zTreeStyle.css"/>
  <script src="${ctx}/qbdmsStatic/public/ztree/jquery.min.js"></script>
  <script src="${ctx}/qbdmsStatic/public/ztree/jquery.ztree.all.min.js"></script>
  <script type="text/javascript">
    var __ctx = "${ctx}";
  </script>
  <style>
    .qbdms-TBinformation{margin-left: 0;font-size: 15px}
    .qbdms-TBinformationText{margin-left: 145px;}
  </style>
</head>
<body class="listBody">
<div class="qbdms-bodyDiv" >
  <div class="qbdms-backDiv">
    <div class="layui-table-view-body" style="padding: 0 24px 24px;">
      <div class="qbdms-formTitle" style="border-bottom: 1px solid #E5F0FF">质量信得过班组 <i  class="qbdms-returnOn closeWindow" id="back">返回</i></div>
      <form class="layui-form treeFormPreview" requrl="${ctx}/qbdms/wQbdTrustTeam/get" lay-filter="wQbdTrustTeamDataForm" id="wQbdTrustTeamDataForm">
        <@fillDept.dept id="tbxx"/>
        <div class="layui-row">
          <div style="width: 40%">
            <label class="layui-form-label qbdms-label" title="密级">密级<span style="color: red;">*</span></label>
            <div class="layui-input-block qbdms-input">
              <@secSelect.sec_select data_src=1 required=true name="secret"/>
            </div>
          </div>

          <div style="width: 50%">
            <label class="layui-form-label qbdms-label" title="班组名称">班组名称<span style="color: red;">*</span></label>
            <div class="layui-input-block qbdms-input">
              <input type="text" name="teamname" lay-reqtext="班组名称是必填项" placeholder="请输入"
                     autocomplete="off" class="layui-input  textInput" maxlength="80" lay-verify="required">
            </div>
          </div>
          <div style="width: 50%">
            <label class="layui-form-label qbdms-label" title="单位">单位<span style="color: red;">*</span></label>
            <div class="layui-input-block qbdms-input">
              <select id="teamdeptid" name="teamdeptid" autocomplete="off"
                      class="layui-input" lay-filter="teamdeptid"
                      fieldname="teamdeptid" lay-verify="required"
                      lay-reqtext="单位是必填项">
              </select>
            </div>
          </div>
          <div style="width: 50%">
            <label class="layui-form-label qbdms-label" title="申报类别">申报类别<span style="color: red;">*</span></label>
            <div class="layui-input-block qbdms-input">
              <@dicSelect.dic name="declares" reqtext="申报类别是必填项" verify="required" nodeKey="bzsblb" />
            </div>
          </div>

          <div style="width: 50%">
            <label class="layui-form-label qbdms-label" title="班组人数">班组人数<span style="color: red;">*</span></label>
            <div class="layui-input-block qbdms-input">
              <input type="text" name="teamcount" placeholder="请输入"
                     autocomplete="off" class="layui-input  textInput" lay-verify="required|number"
                     lay-reqtext="班组人数是必填项"  maxlength="6" fieldname="teamcount">
            </div>
          </div>
          <div class="" style="width: 45%">
            <label class="layui-form-label qbdms-label" title="创建时间">创建时间<span style="color: red;">*</span></label>
            <div class="layui-input-block qbdms-input">
              <input type="text" placeholder="请选择" autocomplete="off"
                     class="layui-input dateTimeFiled input-right time-init" name="createTime"
                     maxlength="7" lay-verify="required" lay-reqtext="创建时间是必填项" readonly>
            </div>
          </div>
          <div style="width: 50%">
            <label class="layui-form-label qbdms-label" title="组长">组长<span style="color: red;">*</span></label>
            <button type="button" class="layui-btn qbdms-twoBtn selectorBtn" typeid="4" style="float: right">选择</button>
            <div class="layui-input-block qbdms-input qbdms-inputIsButton">
              <input type="text" name="teamLeaderName" placeholder="请选择"
                     autocomplete="off" class="layui-input  selectorInput"
                     maxlength="500" fieldname="teamLeader"  lay-verify="required" lay-reqtext="组长是必填项" readonly>
              <input type="hidden" name="teamLeaderId" placeholder="请输入小组成员ID"
                     autocomplete="off" class="layui-input  textInput getIds"
                     fieldname="teamLeaderId">
            </div>

          </div>
          <div style="width: 50%">
            <label class="layui-form-label qbdms-label" title="创建目标">创建目标</label>
            <div class="layui-input-block qbdms-input">
              <input type="text" name="createTarget" placeholder="请输入"
                     autocomplete="off" class="layui-input  textInput"
                     maxlength="50" fieldname="createTarget">
            </div>
          </div>
          <div style="width: 50%">
            <label class="layui-form-label qbdms-label" title="创建计划">创建计划</label>
            <div class="layui-input-block qbdms-input">
              <input type="text" name="createPlan" placeholder="请输入"
                     autocomplete="off" class="layui-input  textInput"
                     maxlength="50" fieldname="createPlan">
            </div>
          </div>
          <input type="hidden" name="flowStatus">


          <!--                     <div style="width: 50%">-->
          <!--                        <label class="layui-form-label qbdms-label" title="年度">年度<span style="color: red;">*</span></label>-->
          <!--                        <div class="layui-input-block qbdms-input">-->
          <!--                            <input type="text" name="years" class="layui-input textInput" id="years" readonly="readonly"-->
          <!--                                   lay-verify="required" lay-reqtext="年度是必填项" placeholder="请输入" fieldname="years">-->
          <!--                        </div>-->
          <!--                    </div>-->

          <!--                     <div style="width: 50%">-->
          <!--                        <label class="layui-form-label qbdms-label" title="半年">半年<span style="color: red;">*</span></label>-->
          <!--                        <div class="layui-input-block qbdms-input">-->
          <!--                            <@dicSelect.dic name="harfyear" reqtext="半年是必填项" verify="required" nodeKey="bn" />-->
          <!--                        </div>-->
          <!--                    </div>-->


          <!--                     <div style="width: 50%">-->
          <!--                        <label class="layui-form-label qbdms-label" title="奖励金额（元）">奖励金额（元）</label>-->
          <!--                        <div class="layui-input-block qbdms-input">-->
          <!--                            <input type="text" name="money" placeholder="请输入" autocomplete="off"-->
          <!--                                   class="layui-input  textInput" lay-verify="money" maxlength="10" fieldname="money">-->
          <!--                        </div>-->
          <!--                    </div>-->



          <!--                     <div style="width: 50%">-->
          <!--                        <label class="layui-form-label qbdms-label" title="获奖等级">获奖等级<span style="color: red;">*</span></label>-->
          <!--                        <div class="layui-input-block qbdms-input">-->
          <!--                            <@dicSelect.dic name="awardlevel" verify="required" reqtext="获奖等级是必填项" nodeKey="bzhjdj" />-->
          <!--                        </div>-->
          <!--                    </div>-->

          <!--                    <div style="width: 80%">-->
          <!--                        <label class="layui-form-label qbdms-label" style="width: 140px">曾获院信得过职工人员</label>-->
          <!--                        <div class="layui-input-block qbdms-input">-->
          <!--                           <textarea name="teampeople" placeholder="请输入" rows="2"-->
          <!--                                     autocomplete="off" class="layui-textarea" maxlength="300"></textarea>-->
          <!--                        </div>-->
          <!--                    </div>-->

          <!--                    <div style="width: 80%">-->
          <!--                        <label class="layui-form-label qbdms-label">贡献点</label>-->
          <!--                        <div class="layui-input-block qbdms-input">-->
          <!--                           <textarea name="devote" placeholder="请输入" rows="2"-->
          <!--                                     autocomplete="off" class="layui-textarea" maxlength="300"></textarea>-->
          <!--                        </div>-->
          <!--                    </div>-->

          <!--                    <div style="width: 80%">-->
          <!--                        <label class="layui-form-label qbdms-label">备注</label>-->
          <!--                        <div class="layui-input-block qbdms-input">-->
          <!--                           <textarea name="remark" placeholder="请输入" rows="2"-->
          <!--                                     autocomplete="off" class="layui-textarea" maxlength="300"></textarea>-->
          <!--                        </div>-->
          <!--                    </div>-->

          <!--                    <div style="width: 80%">-->
          <!--                        <label class="layui-form-label qbdms-label">附件</label>-->
          <!--                        <div class="layui-input-block qbdms-input">-->
          <!--                            <div class="doNotDelThisDiv layui-input-inline">-->
          <!--                                <div class="uploadFileCont">-->
          <!--                                    <button type="button"-->
          <!--                                            class="layui-btn fileUpload qbdms-fileUp iconfont iconupload"-->
          <!--                                            id="fRecommendationfileList"> 上传附件</button><i class="qbdms-fileUpText">支持多个附件上传，附件格式：doc  docx  pdf，文件大小限制不超过100M</i>-->
          <!--                                    <input type="text" id="files" class="uploadInput"-->
          <!--                                           name="files" fieldname="files" style="display: none">-->
          <!--                                    <div class="uploadFileList" fileUploadName="files"></div>-->
          <!--                                </div>-->
          <!--                            </div>-->
          <!--                        </div>-->
          <!--                    </div>-->
          <div class="layui-hide">
            <input type="text" name="id" placeholder="请输入"
                   autocomplete="off" class="layui-input  textInput"
                   maxlength="50" fieldname="id">

            <input type="text" name="teamdept" placeholder="请输入单位id"
                   autocomplete="off" class="layui-input  textInput"
                   maxlength="50" fieldname="teamdept" id="teamdept">
          </div>

          <div class="layui-form-item btnformItem">
            <p style="text-align: left;padding-left: 247px">
                    <span id="hideAndShow" style="display: none;">
                        <a lay-submit lay-filter="wQbdTrustTeam" class="layui-btn btn-n privateSubmit qbdms-oneBtn"
                           requrl="${ctx}/qbdms/wQbdTrustTeam/save" id="urlFormSave">保存</a>
                      <a lay-filter="wProblemresetMsg" id="run" class="layui-btn btn-n qbdms-oneBtn">启动</a>
                            <button type="reset" id="closeWindow" style="margin-left: 10px;"
                                    class="layui-btn layui-btn-sm btn-save qbdms-oneBtnLine">取消
                            </button>
                    </span>
            </p>
          </div>


        </div>
      </form>
    </div>
  </div>
</div>

<script src="${ctx}/qbdmsStatic/public/configFile.js"></script>
<script src="${ctx}/layui/layui.js"></script>
<script>
  var vaildFlag ;
  var runFlag=false;
  var flowStatus="${flowStatus}";
  layui.config({
    base: serverPath.qbdmsPath + staticPath.qbdmsPath //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index','setter', 'laydate', 'jquery','commonDialog', 'common','publicMethods','qbdmsForm','propsHandle'], function () {
    var laydate = layui.laydate;
    var $ = layui.jquery;
    var form = layui.qbdmsForm;
    var common = layui.common;
    var setter = layui.setter;
    var publicMethods = layui.publicMethods;
    var propsHandle = layui.propsHandle;
    var dateTimeFiledLen = $(".dateTimeFiled");
    for (var i = 0; i < dateTimeFiledLen.length; i++) {
      laydate.render({
        elem: dateTimeFiledLen[i] //指定元素
        , type: 'date'
        , trigger: 'click'
      });
    }
    var researchRoomList = eval('${researchRoomList}');
    var researchRoom = function(optionObj, item){
      optionObj.text = item.orgName;
      optionObj.value = item.code;
    };
    common.initDicData("teamdeptid", researchRoomList, "", researchRoom);
    form.on('select(teamdeptid)', function (data) {
      $("#teamdept").val(data.elem[data.elem.selectedIndex].text);
    });
    // form.verify({
    //     number: function (value, item) {
    //         // 如果值为空，不触发校验
    //         if (value && !new RegExp(/^[1-9]\d*$/).test(value)) return common.verifyTitleAdd(item) + "请输入正整数";
    //     },
    //     money: function (value, item) {
    //         if (value && !new RegExp(/^((0\.\d{1,2})|([1-9]\d*\.\d{1,2})|([1-9]+\d*)|0)$/).test(value)) {
    //             return common.verifyTitleAdd(item) + '请输入数字且小数最多两位';
    //         }
    //     }
    // });

    var defProps = {
          //viewMould: 'form/formDef/view/formDesign/moulds/', // 组件模块 存放文件 *****
          viewMould: 'moulds/', // 组件模块 存放文件 *****
          initCss: [
            'style/forms/template/tag',
            'style/forms/template/text',
            'style/forms/template/table',
            'style/forms/template/textArea',
            'style/forms/template/radioOption',
            'style/forms/template/date',
            'style/forms/template/button',
            'style/forms/template/uploadFile',
            'style/forms/template/richText',
            'style/forms/template/select',
            'style/forms/template/checkOption',
            'style/forms/template/dataLexi',
            'style/forms/template/uploadImg',
            'style/forms/template/selector',
            'style/forms/formDevise',
            'style/forms/dragLay',
            'style/forms/formPreview'
          ],
          formAreaInfo: 'html',
          temDate: '.temDate',
          uploadFileBtn: '.uploadFileBtn',
          uploadImgBtn: '.uploadImgBtn',
          richTextArea: '.richTextArea',
          selectInput: '.selectInput',
          radioOptionCont: '.radioOptionCont',
          dataLexiTree: '.dataLexiTree',
          selectorBtn: '.selectorBtn'
        },
        temQuery = new propsHandle()  // 实例化模板功能部分
    ;


    // 初始化模板功能
    temQuery.initTem({
      selectorBtn: defProps.selectorBtn,
      selectorTemPath: setter.views + defProps.viewMould
    });

    vaildFlag = false;
    $("#urlFormSave").click(function () {
      vaildFlag=form.VerifyForm("wQbdTrustTeamDataForm");
    });

    //关闭当前页面
    $("#closeWindow,.closeWindow").click(function () {
      window.location.href = '${ctx}/qbdms/wQbdTrustTeam/view/list';
    });


    if(flowStatus == null || flowStatus == 0|| flowStatus==99){
      $("#hideAndShow").show();
    }else{
      $("#back").hide();
    }
    if(flowStatus==99){
      $("#run").hide();
    }

    var id = "${id}";
    var common = layui.common;
    var index = parent.layer.getFrameIndex(window.name);
    common.updateForm({
      name: 'wQbdTrustTeamDataForm',
      idValue: "${id}",
      primary: "id",
      getCallback: function (data) {
        $("input[name='teamLeaderName']").attr("ids", data.data.teamLeaderId);
      },
      updateCallback: function (data) {
        if((flowStatus==0||flowStatus==""||null==flowStatus)&&runFlag==true){
          run(data.data.id);
        }
        if (common.filterRecord(data)) {
          if ($(".privateSubmit")) {
            $(".privateSubmit").attr("disabled", false).css("pointer-events", "auto");
          }
          if((flowStatus=="0" || flowStatus==null||flowStatus==""||flowStatus=="99")&&runFlag==false) {
            layer.alert(publicMethods.confirmStyle(data.msg),
                {title: false, skin: 'confirm-class'}, function (index) {
                  layer.close(index);
                  window.location.href = '${ctx}/qbdms/wQbdTrustTeam/view/list';
                });
          }
        } else {
          if((flowStatus=="0" || flowStatus==null||flowStatus==""||flowStatus=="99")&&runFlag==false) {
            layer.alert(publicMethods.confirmStyle(data.msg),
                {title: false, skin: 'confirm-class'}, function (index) {
                  layer.close(index);
                  window.location.href = '${ctx}/qbdms/wQbdTrustTeam/view/list';
                });
          }
        }
        runFlag=false;
        return false;
      }
    });

    $("#run").click(function () {
      var flag=form.VerifyForm("wQbdTrustTeamDataForm");
      if(flag==false){
        return false;
      }
      runFlag=true;
      $("#urlFormSave").click();
    })
    function run(id) {
      var id = id;
      var teamname = $("input[name='teamname']").val();
      var teamcount = $("input[name='teamcount']").val();
      var teamdept = $("input[name='teamdept']").val();
      var teamdeptid = $("input[name='teamdeptid']").val();
      var teampeople = $("input[name='teampeople']").val();
      var devote = $("input[name='devote']").val();
      var years = $("input[name='years']").val();
      var harfyear = $("input[name='harfyear']").val();
      var numbers = $("input[name='numbers']").val();
      var money = $("input[name='money']").val();
      var remark = $("input[name='remark']").val();
      var files = $("input[name='files']").val();
      var declareclass = $("input[name='declareclass']").val();
      var states = $("input[name='states']").val();
      var evaluatestatus = $("input[name='evaluatestatus']").val();
      var evaluatedate = $("input[name='evaluatedate']").val();
      var evaluateman = $("input[name='evaluateman']").val();
      var evaluatemanid = $("input[name='evaluatemanid']").val();
      var awardlevel = $("input[name='awardlevel']").val();
      var declares = $("input[name='declares']").val();
      var fillman = $("input[name='fillman']").val();
      var fillmanaccount = $("input[name='fillmanaccount']").val();
      var filldept = $("input[name='filldept']").val();
      var filldeptid = $("input[name='filldeptid']").val();
      var filldepthospital = $("input[name='filldepthospital']").val();
      var filldepthospitalid = $("input[name='filldepthospitalid']").val();
      var belongdeptname = $("input[name='belongdeptname']").val();
      var filldate = $("input[name='filldate']").val();
      var secret = $("input[name='secret']").val();
      var tenantId = $("input[name='tenantId']").val();
      var createBy = $("input[name='createBy']").val();
      var createTime = $("input[name='createTime']").val();
      var updateBy = $("input[name='updateBy']").val();
      var updateTime = $("input[name='updateTime']").val();
      var reportStatus = $("input[name='reportStatus']").val();
      var reportReason = $("input[name='reportReason']").val();
      var reportStatusTemp = $("input[name='reportStatusTemp']").val();
      var returnmsg = $("input[name='returnmsg']").val();
      var reportDate = $("input[name='reportDate']").val();
      var teamLeaderId = $("input[name='teamLeaderId']").val();
      var teamLeaderName = $("input[name='teamLeaderName']").val();
      var createTarget = $("input[name='createTarget']").val();
      var createPlan = $("input[name='createPlan']").val();
      var flowStatus = $("input[name='flowStatus']").val();
      var nowData = {"id": id,"teamname": teamname,"teamcount": teamcount,"teamdept": teamdept,"teamdeptid": teamdeptid,"teampeople": teampeople,"devote": devote,"years": years,"harfyear": harfyear,"numbers": numbers,"money": money,"remark": remark,"files": files,"declareclass": declareclass,"states": states,"evaluatestatus": evaluatestatus,"evaluatedate": evaluatedate,"evaluateman": evaluateman,"evaluatemanid": evaluatemanid,"awardlevel": awardlevel,"declares": declares,"fillman": fillman,"fillmanaccount": fillmanaccount,"filldept": filldept,"filldeptid": filldeptid,"filldepthospital": filldepthospital,"filldepthospitalid": filldepthospitalid,"belongdeptname": belongdeptname,"filldate": filldate,"secret": secret,"tenantId": tenantId,"createBy": createBy,"createTime": createTime,"updateBy": updateBy,"updateTime": updateTime,"reportStatus": reportStatus,"reportReason": reportReason,"reportStatusTemp": reportStatusTemp,"returnmsg": returnmsg,"reportDate": reportDate,"teamLeaderId": teamLeaderId,"teamLeaderName": teamLeaderName,"createTarget": createTarget,"createPlan": createPlan,"flowStatus": flowStatus};
      $.ajax({
        url:"${ctx}/qbdms/wQbdTrustTeam/run",
        type: "post",
        dataType: 'json',
        contentType : 'application/json',
        data: JSON.stringify(nowData),
        success : function (data) {
          if (common.filterRecord(data)) {
            layer.alert(publicMethods.confirmStyle(data.msg),
                {title: false, skin: 'confirm-class'}, function (index) {
                  layer.close(index);
                  window.location.href = '${ctx}/qbdms/wQbdTrustTeam/view/list';
                });
          } else {
            layer.alert(publicMethods.confirmStyle(data.msg),
                {title: false, skin: 'confirm-class'}, function (index) {
                  layer.close(index);
                  window.location.href = '${ctx}/qbdms/wQbdTrustTeam/view/list';
                });
          }
          return false;
        },
        error : function (XMLHttpRequest, textStatus, errorThrown) {
          layer.alert(publicMethods.confirmStyle("内容已保存，启动失败"),
              {title: false, skin: 'confirm-class'}, function (index) {
                layer.close(index);
                window.location.href = '${ctx}/qbdms/wQbdTrustTeam/view/list';
              });
        }
      })
    }
  });
</script>
</body>
</html>